Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow negative literals in conditions #223

Merged

Conversation

ItEndsWithTens
Copy link
Contributor

Hi, excellent project you've got here! I can't thank you enough, it's proving exceptionally useful, but I've run into a small bug I thought I should try to fix: conditions with negative numeric literals show an error despite working in MSBuild.

I'm using the IndexOf property function to find a character in a string, and then store its index in a property. When the character in question can't be found said function returns -1, and I check for that in a PropertyGroup condition later on:

<PropertyGroup Condition="$(MyPotentiallyNegativeProperty) > -1">
    <Foo>bar</Foo>
</PropertyGroup>

As of commit 8abab26 this extension puts an error squiggle under the hyphen, reporting that it expects a right parenthesis, but the comparison works as expected in MSBuild.

Please excuse me if I've overstepped my bounds, but the changes required turned out to be rather simple, as far as I can tell, so I felt a pull request was justified. I'm not hugely confident that my addition of test cases to TestParseNoError is the best way to test for this, but after all the goal is ultimately to get those examples to parse without error. The new test cases fail before my changes but succeed afterwards, and all other tests continue to pass as well.

By all means let me know if I need to change anything, and thank you again for all your hard work!

@mhutch
Copy link
Owner

mhutch commented May 3, 2024

This pull request is great, thank you for the contribution and the kind comments 😄

@mhutch mhutch merged commit f0d663d into mhutch:main May 3, 2024
1 check passed
@ItEndsWithTens ItEndsWithTens deleted the feature/fix-condition-negative-literals branch May 3, 2024 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants